<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .p1{
            line-height: 100px;
            background-color: #ed1250;
        }
        
        .p2{
            line-height: 200px;
            height: 200px;
            background-color: blue;
        }
    </style>
</head>
<body>

<div>
    <p class="p1">垂直居中，仅适用单行文本内容</p>
</div>
<div>
    <p class="p2">垂直居中，仅适用单行文本内容</p>
</div>
</body>
</html>